import streamlit as st
import base64
#页面美化
st.set_page_config(
    page_title="AI小助手选择聊天",
    page_icon="🤖"
)
#会发光的字体
st.write("""
<style>
.neon-glow {
    font-size: 50px;
    color: #fff;
    text-shadow: 0 0 10px #FFBBFF, 0 0 20px #FFBBFF, 0 0 30px #FFBBFF, 0 0 40px #FFBBFF, 0 0 70px #FFBBFF, 0 0 80px #FFBBFF, 0 0 100px #FFBBFF, 0 0 150px #FFBBFF;
    animation: glow 1s ease-in-out infinite alternate-reverse;
}

@keyframes glow {
    to {
        text-shadow: 0 0 5px #FFBBFF, 0 0 10px #FFBBFF, 0 0 15px #FFBBFF, 0 0 20px #FFBBFF, 0 0 35px #FFBBFF, 0 0 40px #FFBBFF, 0 0 50px #FFBBFF, 0 0 75px #FFBBFF;
    }
}
</style>
""", unsafe_allow_html=True)

st.markdown('<p class="neon-glow">💕请选择你需要翻译的语言💕</p >', unsafe_allow_html=True)
def main_bg(main_bg):
    main_bg_ext = "jpg"
    st.markdown(
        f"""
         <style>
         .stApp {{
             background: url(data:image/{main_bg_ext};base64,{base64.b64encode(open(main_bg, "rb").read()).decode()});
             background-size: cover
         }}
         </style>
         """,
        unsafe_allow_html=True)
main_bg('login.jpg')

col1,col2,col3 = st.columns(3)
with col1:
    image_url1 = "https://photo.16pic.com/00/67/66/16pic_6766047_b.jpg"
    st.image(image_url1, width=200)
    bt1 = st.button("英语")
    if bt1:
        st.switch_page("pages/english_translation.py")
with col2:
    image_url2 = "https://img0.baidu.com/it/u=2989745478,2317818941&fm=253&fmt=auto&app=120&f=JPEG?w=972&h=729"
    st.image(image_url2, width=200)
    bt2 = st.button("日语")
    if bt2:
        st.switch_page("pages/japanese_translation.py")
with col3:
    image_url3 = "https://t10.baidu.com/it/u=3248566555,191101372&fm=30&app=106&f=JPEG?w=640&h=359&s=738066AE0CD35ACC1AA714770300F07B"
    st.image(image_url3, width=260)
    bt3 = st.button("泰语")
    if bt3:
        st.switch_page("pages/thai_translation.py")

option = st.sidebar.selectbox(
    label="请选择你想要返回的内容",
    options=("请选择","登录","重新选择模块")
    )
if option == "登录":
    st.switch_page("login.py")
if option == "重新选择模块":
    st.switch_page("pages/Intelligent-selection-interface.py")
